import 'package:flutter/material.dart';

class RegisterPage8 extends StatefulWidget {
  const RegisterPage8({Key? key}) : super(key: key);

  @override
  _RegisterPageState8 createState() => _RegisterPageState8();
}

class _RegisterPageState8 extends State<RegisterPage8> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('联系方式'),
        backgroundColor: Colors.purple,
        elevation: 0, // 移除阴影
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0), // 边缘内边距
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start, // 子项左对齐
          children: [
            Container(
              width: double.infinity, // 宽度充满父容器
              height: 250, // 高度设为200
              decoration: BoxDecoration(
                color: Colors.purple.withOpacity(0.5), // 紫色半透明背景
                borderRadius: BorderRadius.all(Radius.circular(10.0)), // 圆角
                image: DecorationImage(
                  image: NetworkImage('https://img2.baidu.com/it/u=995451037,1448033955&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'), // 替换为你的图片路径
                  fit: BoxFit.cover, // 图片填充方式
                ),
              ),
            ),
            SizedBox(height: 20.0), // 间隔
            Container(
              decoration: BoxDecoration(
                color: Colors.white, // 背景色为白色
                borderRadius: BorderRadius.all(Radius.circular(10.0)), // 圆角
                boxShadow: [
                  BoxShadow(
                      color: Colors.grey.withOpacity(0.2),
                      spreadRadius: 2.0,
                      blurRadius: 5.0,
                      offset: Offset(0, 2))
                ], // 阴影效果
              ),
              child: Column(
                children: [
                  buildContactRow(
                    '微信联系',
                    '清扫二维码，微信关注我们',
                    'https://img1.baidu.com/it/u=3345218527,2272560259&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500', // 替换为微信图标路径
                  ),
                  buildContactRow(
                    '服务热线',
                    'XXX-XXXXX',
                    'https://img1.baidu.com/it/u=1729099766,1386424141&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', // 替换为电话图标路径
                  ),
                  buildContactRow(
                    '官方网站',
                    'www.guanfangwangzhan.com',
                    'https://img1.baidu.com/it/u=4104662088,2047060242&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', // 替换为网站图标路径
                  ),
                  buildContactRow(
                    '售后服务网点',
                    '我的地址',
                    'https://img0.baidu.com/it/u=1672772001,2567515391&fm=253&fmt=auto&app=138&f=JPEG?w=596&h=500', // 替换为位置图标路径
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
      bottomNavigationBar: BottomNavigationBar(
        showSelectedLabels: true,
        // 如果想要隐藏选中时的文字
        showUnselectedLabels: true,
        // 如果想要显示未选中时的文字
        type: BottomNavigationBarType.fixed,

        selectedItemColor: Colors.purple,
        // 选中项的颜色
        unselectedItemColor: Colors.grey,
        // 未选中项的颜色

        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.phone),
            label: '联系方式',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: '首页',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.face),
            label: '我的',
          ),
        ],
      ),
    );
  }
}
Widget buildContactRow(String title, String subtitle, String imagePath) {
  return Padding(
    padding: const EdgeInsets.only(bottom: 15.0), // 行间间隔
    child: Row(
      children: [
        Container(
          width: 40.0, // 圆形图片宽度
          height: 40.0, // 圆形图片高度
          decoration: BoxDecoration(
            shape: BoxShape.circle, // 圆形
            image: DecorationImage(
              image: NetworkImage(imagePath), // 替换为图标路径
              fit: BoxFit.cover, // 图片填充方式
            ),
          ),
        ),
        SizedBox(width: 10.0), // 图片与文字之间的间隔
        Column(
          crossAxisAlignment: CrossAxisAlignment.start, // 文字左对齐
          children: [
            Text(title, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500)), // 标题
            Text(subtitle, style: TextStyle(fontSize: 14.0)), // 副标题
          ],
        ),
      ],
    ),
  );
}
